<?php

namespace App\Admin\Controllers;

use App\Models\CaseCustomer;
use Illuminate\Http\Request;
use Dcat\Admin\Http\Controllers\AdminController;

class CaseShareController extends AdminController
{
    public function sharestore(Request $request){
        if($request['user']){
            $user = explode(",",$request['user']);
        }else {
            $user = [];
        }

        CaseCustomer::find($request['customer'])->SharesUser()->sync($user, true);
        return redirect('admin/casecustomers/' . $request['customer']);
    }
}
